EuSqlite eusqlite_wiki https://eusqlite.shoutwiki.com/wiki/Main_Page MediaWiki 1.35.13 first-letter Media Special Talk User User talk EuSqlite EuSqlite talk File File talk MediaWiki MediaWiki talk Template Template talk Help Help talk Category Category talk Module Module talk Gadget Gadget talk Gadget definition Gadget definition talk Main Page 0 1 57 56 2015-02-04T01:25:12Z Crylex 3383654 57 wikitext text/x-wiki {{MainTemplate | welcome = Welcome to '''{{SITENAME}}!''' | blurb = Euphoria's SQLite library | about_title = About this site | about_content = The new home wiki of EUSqlite, since the demise of free wikispaces pages. If you need any help, don't hesitate to contact ShoutWiki's [[Special:ListUsers/staff|Customer Support Team]]. | featured_title = Featured Article | featured_content = Work in progess, happy to accept any database related articles! | didyouknow_title = Did you know... | didyouknow_content = * ...that you can add your own "did you know" tidbits right here? | news_title = News | news_content = * This wiki was started! }} f6e45n69wtn56t0vnbv267o3a9xmqku About 0 35 51 2014-09-22T08:36:07Z Crylex 3383654 Created page with "EUSQLite is a wrapper for the SQLite libraries, from the original libraries by Ray Smith. Ray is no longer programming with euphoria, but has left his euphoria programs on hi..." 51 wikitext text/x-wiki EUSQLite is a wrapper for the SQLite libraries, from the original libraries by Ray Smith. Ray is no longer programming with euphoria, but has left his euphoria programs on his web site. If you don't know what Euphoria is, then check out the links to your left. SQLite is multi-platform (or at least bi-platform) running on both Windows and Linux. The libraries are very small, and produce very compact and fast databases (see the SQLite homepage for more information), and can be used to power web based databases, and any other applications where databases are required. SQLite has some difficulty with record locking over a network, as it is not a true client/server database, but it should be possible to write an application to act as a server to network based requests. SQLite uses a (large) subset of SQL - I have included some SQL tutorial links if you are new to SQL. Or just use a google search to find one that appeals to you. Other databases are available - EDS (the euphoria database system - included with euphoria, not SQL (unless you use one of the libraries written for this)), MYSQL, and Tsnami, and all have there disadvantages and advantages - choose for yourself. There are 2 versions of SQLite - the older 2.x series (of which at the time of writing 2.8.15 was the most current), and the 3 series (most current 3.08). These produce databases which are incompatible with each other. The 3 series produce more compact databases for the same data, and include the ability to store BLOBs. SQLite 2 will no longer be supported, but the old wrappers will continue to remain here. With the eu wrappers the syntax for accessing the databases is exactly the same - ie it is transparent to the euphoria program which sql library you are using. If you have any questions regarding the use of the library, or the use of SQL, just post them to the eu mailing list. Chris hn4baywnvao61pmbtxc7b3adld63ccv Documentation 0 36 55 54 2014-09-22T08:52:18Z Crylex 3383654 Protected "[[Documentation]]": Just want t his page maintained by known people ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite)) 55 wikitext text/x-wiki Documentation for eusqlite Introduction This guide will give you a quick introduction on how to use euSQLite in your programs. There is some information in the base SQLite docs found in the sqldocs\ directory which you need to read as well. You should take the time to read at least the FAQ.htm, Query.htm and sqlite_util.htm. Basic structure This is the skeleton of a typical euSQLite program. include "eusqlite.ew" atom db sequence data db = sqlite_open("{filename_of_your_database",0) ... do some processing / user input etc data = sqlite_get_table(db, "{SQL statements go here}") if sqlite_last_err_no != SQLITE_OK then ... do some error processing end if ... do some more processing / user input etc sqlite_close(db) It basically comes down to: Include "euSQLite.ew" Open your database - sqlite_open() Execute SQL statements - sqlite_get_table() Close your database - sqlite_close() '''Global constants''' :SQLITE_OK = 0 Successful result :SQLITE_ERROR = 1 SQL error or missing database :SQLITE_INTERNAL = 2 An internal logic error in SQLite :SQLITE_PERM = 3 Access permission denied :SQLITE_ABORT = 4 Callback routine requested an abort :SQLITE_BUSY = 5 The database file is locked :SQLITE_LOCKED = 6 A table in the database is locked :SQLITE_NOMEM = 7 A malloc() failed :SQLITE_READONLY = 8 Attempt to write a readonly database :SQLITE_INTERRUPT = 9 Operation terminated by sqlite_interrupt() :SQLITE_IOERR = 10 Some kind of disk I/O error occurred :SQLITE_CORRUPT = 11 The database disk image is malformed :SQLITE_NOTFOUND = 12 (Internal Only) Table or record not found :SQLITE_FULL = 13 Insertion failed because database is full :SQLITE_CANTOPEN = 14 Unable to open the database file :SQLITE_PROTOCOL = 15 Database lock protocol error :SQLITE_EMPTY = 16 (Internal Only) Database table is empty :SQLITE_SCHEMA = 17 The database schema changed :SQLITE_TOOBIG = 18 Too much data for one row of a table :SQLITE_CONSTRAINT = 19 Abort due to constraint violation :SQLITE_MISMATCH = 20 Data type mismatch :SQLITE_MISUSE = 21 Library used incorrectly :SQLITE_NOLFS = 22 Uses OS features not supported on host :SQLITE_AUTH = 23 Authorization denied :SQLITE_ROW = 100 sqlite_step() has another row ready :SQLITE_DONE = 101 sqlite_step() has finished executing :SQLITE_STATIC = 0, :SQLITE_TRANSIENT = -1 '''Global variables''' integer sqlite_last_error_number sequence sqlite_last_error_description integer SQLITE_MAX_FIELD_LENGTH integer SQLITE_MAX_ERROR_LENGTH integer SQLITE_MAX_VERSION_LENGTH < Function list > Original routines, Ray Smith : procedure sqlite_free(atom address) function sqlite_open(sequence filename, integer mode) procedure sqlite_close(atom db_handle) function sqlite_exec(atom db_handle, sequence sql_command) procedure sqlite_free_table(atom data_address) function sqlite_get_table(atom db_handle, sequence sql_command) function sqlite_libversion() The following routines courtesy of Tone Skoda : function sqlite_prepare(atom db_handle, sequence sql_command) function sqlite_step(atom db_handle, atom stmt) procedure sqlite_reset(atom db_handle, atom stmt) function sqlite_finalize(atom db_handle, atom stmt) procedure sqlite_bind_int(atom db, atom stmt, integer param_index, integer val) procedure sqlite_bind_double(atom db, atom stmt, integer param_index, atom val) procedure sqlite_bind_text(atom db, atom stmt, integer param_index, sequence val) procedure sqlite_bind_blob(atom db, atom stmt, integer param_index, object val) function sqlite_column_int(atom db, atom stmt, integer column_num) function sqlite_column_bytes(atom db, atom stmt, integer column_num) function sqlite_column_text(atom db, atom stmt, integer column_num) function sqlite_column_blob(atom db, atom stmt, integer column_num) function compress(sequence thing) function decompress(sequence thing) Th following routines Chris Burch : function sqlite_query_database(sequence database, sequence cmd) < procedure sqlite_free(atom address) > Used to free memory obtained from sqlite3_mprintf() or sqlite3_vmprintf(). These functions are implemented internally in sqlite3 error reporting, so this is used to clear memory allocated to error character strings. example : err_addr = peek4u(err_ptr_addr) if err_addr > 0 then sqlite_last_err_desc = peek_sequence(err_addr, SQLITE_MAX_ERR_LENGTH) sqlite_free(err_addr) end if < function sqlite_open(sequence filename, integer mode) > Opens a database for access. If the database does not exist then it is created. Returns the database handle. example : sequence data atom sql_db sql_db = sqlite_open("Database_to_open", 0) if sql_db <= 0 then --can't open database end if < procedure sqlite_close(atom db_handle) > Closes a database associated with db_handle, previously opend with sqlite_open() function sqlite_exec(atom db_handle, sequence sql_command) Executes an sql command. Note this a very much simplified version of the C function. Returns SQLITE_OK, SQLITE_ABORT or SQLITE_BUSY example : if (sqlite_exec(db, "BEGIN TRANSACTION") != SQLITE_OK) then etc end if < procedure sqlite_free_table(atom address) > Frees the memory allocated to a set of results created by sqlite_get_table. Called internally from sqlite_get_table() - no requirement to call externally. < function sqlite_get_table(atom db_handle, sequence sql_command) > This is a wrapper for sqlite_exec() Returns data associated with a query, in the form of a sequence. Operates on a previously opened database. example : global function query_database(sequence database, sequence cmd) --a universal get info from a database function sequence data atom sql_db sql_db = sqlite_open(database, 0) if sql_db <= 0 then --handle errors end if data = sqlite_get_table(sql_db, cmd) if sqlite_last_err_no != SQLITE_OK then --handle your errors here end if sqlite_close(sql_db) If the sql query results in no data then a sequence of length 0 is returned. If data is found, then a sequence of the form data[row][column] is returned. The first row of data is always the column headers, subsequent rows are the returned records < function sqlite_libversion() > Returns a sequence with the SQLite library version example : printf(1, "SQLite Library Version %s\n", {sqlite_libversion()}) < function sqlite_prepare(atom db_handle, sequence sql_command) > Prepares an sql command for execution. Sql commands prepared with this can be 're-used' to allowing insertion of new data using the 'bind' commands. This is much faster than repeatedly creating a new sql command. Returns a handle to the sql_command example : atom stmt stmt = sqlite_prepare(db, "insert into table_name values(?,?,?,?)") Note the variable positions are delineated by the '?' - you insert variables in here. (See sqlite_insert.exw) < function sqlite_step(atom db_handle, atom stmt) > Executes the sql stmt prepared with sqlite_prepare, with values inserted by one of the 'bind' family example : Void = sqlite_step(db, stmt) (See sqlite_insert.exw) < procedure sqlite_reset(atom db_handle, atom stmt) > Resets the prepared stmt, ready to accept its next set of values example : sqlite_reset(db, stmt) (See sqlite_insert.exw) < function sqlite_finalize(atom db_handle, atom stmt) > Removes the sql stmt from memory. Can return SQL_ABORT, usually just VOID example : Void = sqlite_finalize(db, stmt) (See sqlite_insert.exw) < procedure sqlite_bind_int(atom db, atom stmt, integer param_index, integer val) > < procedure sqlite_bind_double(atom db, atom stmt, integer param_index, atom val) > < procedure sqlite_bind_text(atom db, atom stmt, integer param_index, sequence val) > < procedure sqlite_bind_blob(atom db, atom stmt, integer param_index, object val) > Binds a value to a a prepared stmt, ready for execution. (See sqlite_insert.exw) < function sqlite_column_int(atom db, atom stmt, integer column_num) > < function sqlite_column_bytes(atom db, atom stmt, integer column_num) > < function sqlite_column_text(atom db, atom stmt, integer column_num) > < function sqlite_column_blob(atom db, atom stmt, integer column_num) > These routines return information about the information in a single column of the current result row of a query. Can't really say much more than that atm, because I don't really understand them myself. Here's an article. http://interactive.linuxjournal.com/article/7803 < function sqlite_query_database(sequence database, sequence cmd) > Opens, queries, and closes a database. One line access to databases. Returns the dataset, or a sequence of length 0 if no data. example : data = sqlite_query_database("newdb.sql", "create table blah (id INTEGER PRIMARY KEY, fruit TEXT)") will create a new database, create a table within that database, then close the database. Note - this is inherently slower than opening the database, doing several get_tables, then closing the database, and is much much slower than preparing atatements, and binding values. Suggest you use this in speed critical applications where you only have an occasional query. Also, some poeple like to open the database at the beginning of their application, or at least while large chunks of the program are running. In that case, don't use this, as this repeatedly opens and closes the database. < function compress(sequence thing) > < function decompress(sequence thing) > Comress and decompresses sequence. Returns the compressed or decompressed sequence. Usefull for compressi sqr76epl6cnrztp5mto7w01w4avesv6 Installation 0 34 50 2014-09-22T08:34:46Z Crylex 3383654 Created page with "Choose which version of the library you are going to use. Choose which platform you wish to run on. Go to the SQLite library page, or now get the latest libraries, and binarie..." 50 wikitext text/x-wiki Choose which version of the library you are going to use. Choose which platform you wish to run on. Go to the SQLite library page, or now get the latest libraries, and binaries here Download the appropriate library or libraries. Download the appropriate wrapper. Note the wrappers work under both Linux and Windows, and need no modification to run, but they do need to be installed in slightly different places. * Windows XP era - the dll library should be installed into Windows\system32. Windows 7 and up - install into the windows/system folder. Note 64 bit Euphoria will not run with the 32 bit sqlite3.dll. see here * Linux - the .so library should be installed into /usr/lib , and then ldconfig should be run - update - there are various ways of doing this, but I have updated the library so that it always links to sqlite3.so - usually located in /usr/lib, and from that you symlink to where you place the library (currently, in my case, /usr/local/lib). This then allows you to install updates, and just change the symlink target. * (Both) The eu wrappers (eusql.ew or eusql3.ew and wrapper.ew) should be installed into your euphoria\include directory. The downloads also include some simple test programs (thanks to Ray Smith), and the 2.x wrapper includes the SQLite docs - not entirely compatible with SQLite 3.x, but these docs are available on the web site. Final note - this software is free to use as you wish. If you have any questions, please use the Euphoria list. There is no license as such with it, but if you want one, then use the sqlite licence. It is also not guaranteed free from any bugs at all, if you find any let me know, but if it destroys all your data - tough! However, I have been using it reliably now since 2003, with absolutely no program related data loss at all. ==Update to installation for sqlite lib version 3.4.2== This is for Linux only - Windows .dll s are unaffected. Euphoria can't seem to access the sqlite binaries release. This was quite a puzzle for a while, and I had to jump through some hoops to get it to run on a 32 bit system, but this is how I did it. Euphoria is also compiled on a 32 bit system, and won't access shared objects compiled on a 64 bit system, so compiling sqlite on a 64 bit didn't work either. Finally, I compiled sqlite on a 32 bit system, and it worked there, so I copied this 32 bit library over to the 64 bit system, and it worked. Heres a step by step. 1. On a 32 bit system compile and install sqlite from sources. 2. The library is installed into /usr/local/lib/libsqlite3.so.0.8.6 (confusingly enough this is sqlite library 3.4.2) 3. Copy all the 32 bit libraries to /usr/local/lib on your 64 bit system (ie libsqlite*) 4. Either direct your euphoria program to this file, or change the symlink in /usr/lib to point to the above file 5. Test it ==Update for sqlite version 3.5.4== I've update the lib to sqlite-3.5.4.so. This may not be the same on your system, but on my system I just put the lib in /usr/local/lib, and symlinked from /usr/lib/sqlite3.so to that file, and it just worked. No need to build from the 32 bit sources. Note, the wrapper always points to /usr/lib/sqlite3.so - just change where this points to for future updates. hdndrrojsl4pdinnwks81s7gkx2sbhr Main Page 0 1 57 56 2015-02-04T01:25:12Z Crylex 3383654 57 wikitext text/x-wiki {{MainTemplate | welcome = Welcome to '''{{SITENAME}}!''' | blurb = Euphoria's SQLite library | about_title = About this site | about_content = The new home wiki of EUSqlite, since the demise of free wikispaces pages. If you need any help, don't hesitate to contact ShoutWiki's [[Special:ListUsers/staff|Customer Support Team]]. | featured_title = Featured Article | featured_content = Work in progess, happy to accept any database related articles! | didyouknow_title = Did you know... | didyouknow_content = * ...that you can add your own "did you know" tidbits right here? | news_title = News | news_content = * This wiki was started! }} f6e45n69wtn56t0vnbv267o3a9xmqku User:Cook879 2 26 39 2012-09-08T10:44:22Z MediaWiki default 30443056 39 wikitext text/x-wiki {{s:User:Cook879}} 9su9qgtkhumcgf8i780pgt3wo24q5pz User:Jack Phoenix 2 14 25 2010-10-03T15:20:51Z MediaWiki default 30443056 25 wikitext text/x-wiki {{s:User:Jack Phoenix}} 6ro834g7pksykgxv8eh2repv34pkxgf User:Lcawte 2 25 38 37 2012-08-18T14:01:09Z MediaWiki default 30443056 38 wikitext text/x-wiki {{s::User:Lcawte}} frltizqdkch5uoothg3wyd5gcpgzfni User:Lynton 2 18 29 2010-10-03T15:28:32Z MediaWiki default 30443056 29 wikitext text/x-wiki {{s:User:Lynton}} 8h7k36todrq0n17z8j4o7p81r5s2myv User:MediaWiki default 2 23 35 34 2010-12-30T05:43:26Z MediaWiki default 30443056 35 wikitext text/x-wiki This account is used by [[s:ShoutWiki Staff|ShoutWiki Staff]] when performing maintenance tasks. This account is not a bot and cannot be blocked. If there is a problem with an edit from this account, please inform a member of the [[s:Customer Support Team|Customer Support Team]] using [[Special:Contact]]. Thanks, ShoutWiki Staff 8u83a4eosok8vsr2v7vagsq052zlpfg User:Pinky 2 20 31 2010-10-03T15:28:58Z MediaWiki default 30443056 31 wikitext text/x-wiki {{s:User:Pinky}} hgdajp5grwpcoowshkysu9tztoxr2e4 User:Solar Dragon 2 30 44 2013-08-21T20:03:47Z MediaWiki default 30443056 44 wikitext text/x-wiki {{s:User:Solar Dragon}} tg315zz6qwbn7bcbj95b3n93xu2jvoc User talk:Cook879 3 27 41 40 2012-09-08T10:46:56Z MediaWiki default 30443056 41 wikitext text/x-wiki {| align="center" style="background: #ccf; border: 3px solid #8888AA; width: 100%; -moz-border-radius: 80px;" |- | Hi. Welcome to my talk page. Feel free to [http://{{SERVERNAME}}/w/index.php?title=User_talk:Cook879&action=edit&section=new post a message] below. |} r3ikw28tsv3q58cksiya005d2t1n0ig User talk:Crylex 3 32 47 2014-09-22T08:17:32Z ShoutWiki 11 47 wikitext text/x-wiki Hi Crylex, thank you for choosing ShoutWiki to make your wiki. We would suggest that you start your wiki off by doing these few basic things: *Upload a logo. You can do this by uploading an image over [[:File:Wiki.png]]. (not available on some skins) *Design your [[Main Page]]. The main page is likely the first thing users will see. It should be attractive and catch the eye. *Start building content. All wikis need content to become the best they can be. If you need help with making a logo, skin or favicon, please see [[s:w:logocreation|ShoutWiki's Logo Creation Wiki]]. If you need any help with building your wiki, feel free to contact [[s:ShoutWiki Staff|ShoutWiki staff]] either via their talk pages or via [[Special:Contact]]. Alternatively, you can talk to us, or other users, via [[s:ShoutWiki Hub:IRC|IRC]]. Thank you again for using ShoutWiki. [[s:ShoutWiki Staff|ShoutWiki staff]] 08:17, 22 September 2014 klvd4yexw9etsz9tcgywvxp6oal0gm7 User talk:Lcawte 3 29 43 2013-03-28T18:59:56Z MediaWiki default 30443056 43 wikitext text/x-wiki {{s::User talk:Lcawte/header}} 68cjp69hrs0otmdn18l1a2b85wzrzyp User talk:Solar Dragon 3 31 46 45 2013-08-21T21:30:04Z MediaWiki default 30443056 46 wikitext text/x-wiki {{s::User:Solar Dragon/Talkheader}} o2y3a4p2midvn09l97rwprgfdpfgdbp File:Wiki.png 6 28 42 2012-09-13T14:06:18Z MediaWiki default 30443056 42 wikitext text/x-wiki Wiki logo. Upload a new image over this one to set your own logo. dgwmv2n7qsfzlck7bqxtq40b45oxer2 MediaWiki:Monaco-sidebar 8 33 49 2014-09-22T08:29:28Z Crylex 3383654 Created page with "* mainpage|{{SITENAME}} ** About ** Installation ** Libraries ** Documentation ** Dates and times ** Snippets ** Blobs ** Links ** portal-url|portal ** currentevents-url|curre..." 49 wikitext text/x-wiki * mainpage|{{SITENAME}} ** About ** Installation ** Libraries ** Documentation ** Dates and times ** Snippets ** Blobs ** Links ** portal-url|portal ** currentevents-url|currentevents 907l6g17gdquit0smwb1xxhud2lo0zi Template:! 10 10 21 2009-12-30T17:51:29Z MediaWiki default 30443056 21 wikitext text/x-wiki |<noinclude> [[Category:Utility templates|{{PAGENAME}}]]</noinclude> i4u6ct5v4rvu8xqc2nzojl2ho5cuyni Template:HeaderTemplate 10 7 12 2009-05-02T18:34:55Z MediaWiki default 30443056 12 wikitext text/x-wiki <div> <!-- Beginning of header section --> {|style="width:100%;margin-top:+.7em;background-color:#4682B4;border:1px solid #ccc;-moz-border-radius:20px" |style="width:45%;color:#000"| {|style="width:100%;border:solid 0px;background:none" |- |style="width:100%px;text-align:center;white-space:nowrap;color:#000" | <div style="font-size:195%;border:none;margin: 0;padding:.1em;color:#FFFFFF">{{{welcome}}}</div> |}<!-- Blurb & useful links --> |style="width:45%;font-size:125%;color:#FFFFFF"| {{{blurb}}} |}<!-- End of blurb & useful links --> </div> j3mqpp6bt8r07sw2xdrt404pvemv0ha Template:MainTemplate 10 9 18 14 2009-07-08T08:41:15Z MediaWiki default 30443056 18 wikitext text/x-wiki {{HeaderTemplate|welcome={{{welcome}}}|blurb={{{blurb}}}}} <br /> <!-- LEFT COLUMN --> {| width="100%" cellspacing="0" cellpadding="0" style="background:transparent;" |- | width="50%" style="vertical-align:top; padding-right:0.5em;" | <!-- Info about this site --> {{SectionTemplate|title={{{about_title}}}|content={{{about_content}}}}} | width="50%" style="vertical-align:top; padding-left:0.5em;" | <!-- Featured Article --> {{SectionTemplate|title={{{featured_title}}}|content={{{featured_content}}}}} |} <br /> <!-- RIGHT COLUMN --> {| width="100%" cellspacing="0" cellpadding="0" style="background:transparent;" |- | width="50%" style="vertical-align:top; padding-right:0.5em;" | <!-- Did you know... --> {{SectionTemplate|title={{{didyouknow_title}}}|content={{{didyouknow_content}}}}} | width="50%" style="vertical-align:top; padding-left:0.5em;" | <!-- Site news --> {{SectionTemplate|title={{{news_title}}}|content={{{news_content}}}}} |} __NOTOC__ __NOEDITSECTION__ e4p99tjrg6tq47iqlh9ln9ua3v35z2z Template:SectionTemplate 10 8 20 13 2009-07-12T21:34:10Z MediaWiki default 30443056 20 wikitext text/x-wiki <h2 style="border:none; background-color:#4682B4; padding:0.2em 0; margin:0; color:#ffffff; font-size:125%; font-weight:bold; text-indent:0.5em; font-variant:small-caps; -moz-border-radius: 10px">{{{title}}}</h2> <div style="margin-bottom:1em; padding:0.5em 0.8em 0.5em 0.8em;"> {{{content}}} </div> j5b1lar8shlr44bgt4p6ns6h3e72b0p Category:Browse 14 13 24 2009-12-30T17:56:16Z MediaWiki default 30443056 24 wikitext text/x-wiki This is a starting point which can be used to access any article on this wiki. [[Category:Browse]] 5s3x2nudvhqwi71yepyzbt5ozp3acmm Category:Templates 14 12 23 2009-12-30T17:55:03Z MediaWiki default 30443056 23 wikitext text/x-wiki This category is for '''Templates'''. [[Category:Browse]] jpvy9lwat2x4w625g8zef5ao6t97drj Category:Utility templates 14 11 22 2009-12-30T17:54:25Z MediaWiki default 30443056 22 wikitext text/x-wiki This category is for '''Utility templates'''. [[Category:Templates]] 2k1og0eh9magim62rcbfxwmcn1sxnrf